<template>
  <div :class="prefixCls" class="login-box relative w-full h-full">
    <div class="login-left-box">
      <div class="absolute-bg2">
        <img src="../../../assets/images/login-right-bg2.png" />
      </div>
      <div class="logo-box">
        <a href="http://glcs.51wit.com/" target="_blank">
          <img src="../../../assets/images/logo.png" />
        </a>
      </div>
      <div class="login-left-title">
        <div class="title">{{ t('登录') }}</div>
        <div class="sub-title">{{ t('让开发变得更简单') }}</div>
      </div>
      <div :class="`${prefixCls}-form`">
        <LoginForm />
      </div>
    </div>
    <div class="fixed-tool">
      <AppDarkModeToggle v-if="!sessionTimeout" />
      <AppLocalePicker
        class="text-white px-4"
        :showText="false"
        v-if="!sessionTimeout && showLocale"
      />
    </div>
    <div class="fixed-bg1">
      <img src="../../../assets/images/login-right-bg3.png" />
    </div>
    <div class="right-box">
      <div class="img-box">
        <div class="right-absolute">
          <img src="../../../assets/images/login-right-bg1.png" class="bg bg1" />
          <img src="../../../assets/images/login-right-bg1.png" class="bg bg2" />
        </div>

        <img src="../../../assets/images/login-right-bg.png" />
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  // import { computed } from 'vue';
  import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
  import LoginForm from './LoginForm.vue';
  // import { useGlobSetting } from '/@/hooks/setting';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { useDesign } from '/@/hooks/web/useDesign';
  import { useLocaleStore } from '/@/store/modules/locale';

  defineProps({
    sessionTimeout: {
      type: Boolean,
    },
  });

  // const globSetting = useGlobSetting();
  const { prefixCls } = useDesign('login');
  const { t } = useI18n();
  const localeStore = useLocaleStore();
  const showLocale = localeStore.getShowPicker;
  // const title = computed(() => globSetting?.title ?? '');
</script>
<style lang="less">
  @prefix-cls: ~'@{namespace}-login';
  @logo-prefix-cls: ~'@{namespace}-app-logo';
  @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  @dark-bg: #293146;

  .vben-login-form {
    padding: 40px 100px;
    padding-top: 200px;
  }

  .login-box {
    display: flex;
  }

  .logo-box {
    position: relative;
    top: 60px;
    left: 100px;
  }

  .logo-box img {
    width: 200px;
  }

  .login-box .login-left-box {
    flex-basis: 45%;
    background-color: #fff;
    position: relative;
  }

  .login-left-title {
    position: relative;
    top: 120px;
    left: 100px;
  }

  .login-left-title .title {
    font-size: 60px;
    font-weight: 500;
    border: none;
  }

  .login-left-title .sub-title {
    font-size: 24px;
    color: #989db3;
  }

  .login-box .right-box {
    flex-basis: 55%;
    background: linear-gradient(to bottom, #5574f3, #20389a);
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .fixed-tool {
    position: fixed;
    right: 20px;
    top: 40px;
    display: flex;
    z-index: 2;
  }

  .fixed-bg1 {
    position: fixed;
    top: -300px;
    right: -232px;
  }

  .fixed-bg1 img {
    width: 600px;
  }

  .absolute-bg1 {
    position: absolute;
    top: 12%;
    right: -300px;
  }

  .absolute-bg2 {
    position: absolute;
    bottom: 0;
    right: -578px;
  }

  .right-box .img-box {
    margin: 0 auto;
    position: relative;
  }

  .right-box .img-box img {
    width: 90%;
    position: relative;
    margin: 0 auto;
  }

  .right-box .img-box .right-absolute .bg {
    position: absolute;
    width: 200px;
  }

  .right-box .img-box .right-absolute .bg1 {
    left: 10px;
    top: -40px;
  }

  .right-box .img-box .right-absolute .bg2 {
    right: 50px;
    bottom: 50px;
  }

  html[data-theme='dark'] {
    .login-box .login-left-box {
      background-color: #2d354a;
    }

    .login-left-title {
      border: none;
    }

    .login-left-title .title {
      color: #fff;
    }

    .login-box .right-box {
      background: linear-gradient(to bottom, #364876, #112049);
    }
    .@{prefix-cls} {
      background-color: @dark-bg;

      // &::before {
      //   background-image: url(/@/assets/svg/login-bg-dark.svg);
      // }

      .ant-input,
      .ant-input-password {
        background-color: #232a3b;
      }

      .ant-input-affix-wrapper {
        border-color: #525e7c;
        background-color: #232a3b;
      }

      .ant-checkbox-inner {
        border-color: #525e7c;
      }

      .ant-btn:not(.ant-btn-link, .ant-btn-primary) {
        border: 1px solid #4a5569;
      }

      &-form {
        background: transparent !important;
      }

      .app-iconify {
        color: #fff;
      }
    }

    input.fix-auto-fill,
    .fix-auto-fill input {
      -webkit-text-fill-color: #c9d1d9 !important;
      box-shadow: inherit !important;
    }
  }

  .@{prefix-cls} {
    min-height: 100%;
    overflow: hidden;
    @media (max-width: @screen-xl) {
      background-color: #293146;

      .@{prefix-cls}-form {
        background-color: #fff;
      }
    }

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      margin-left: -48%;
      // background-image: url(/@/assets/svg/login-bg.svg);
      background-position: 100%;
      background-repeat: no-repeat;
      background-size: auto 100%;
      content: '';
      @media (max-width: @screen-xl) {
        display: none;
      }
    }

    .@{logo-prefix-cls} {
      position: absolute;
      top: 12px;
      height: 30px;

      &__title {
        font-size: 16px;
        color: #fff;
      }

      img {
        width: 32px;
      }
    }

    .container {
      .@{logo-prefix-cls} {
        display: flex;
        width: 60%;
        height: 80px;

        &__title {
          font-size: 24px;
          color: #fff;
        }

        img {
          width: 48px;
        }
      }
    }

    &-sign-in-way {
      .anticon {
        font-size: 22px;
        color: #888;
        cursor: pointer;

        &:hover {
          color: @primary-color;
        }
      }
    }

    input:not([type='checkbox']) {
      min-width: 360px;

      @media (max-width: @screen-xl) {
        min-width: 320px;
      }

      @media (max-width: @screen-lg) {
        min-width: 260px;
      }

      @media (max-width: @screen-md) {
        min-width: 240px;
      }

      @media (max-width: @screen-sm) {
        min-width: 160px;
      }
    }

    .@{countdown-prefix-cls} input {
      min-width: unset;
    }

    .ant-divider-inner-text {
      font-size: 12px;
      color: @text-color-secondary;
    }
  }
</style>
